package com.example.test17;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserInfoMapper {
    @Select("select * from user_info where username= #{username}")
    List<UserInfo> select1(UserInfo userInfo);


    //写成${'username'}便会形成SQL注入导致全部查询
    @Select("select * from user_info where username= '${username}'")
    List<UserInfo> select2(UserInfo userInfo);

    List<UserInfo> select3(String name);


    @Select(" select * from user_info where username='${name}'")
    List<UserInfo> select4(String name);

    @Select("select * from user_info order by id #{oder}")
    List<UserInfo> select5(String oder);

    @Select("select * from user_info where username like concat('%',#{name},'%')")
    List<UserInfo> select6(String name);
}
